{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "lesbian-springer",
   "metadata": {},
   "source": [
    "## Rolling Update Examples\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "5b1925df",
   "metadata": {},
   "source": [
    "### SKLearn Iris Model\n",
    "\n",
    "We use a simple sklearn iris classification model and do a rolling update"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "interracial-secret",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{}\n",
      "{}\n",
      "{\n",
      "\t\"model_name\": \"iris_1\",\n",
      "\t\"model_version\": \"1\",\n",
      "\t\"id\": \"e36b1d20-ddbb-4bbc-9649-290a8bb14ac4\",\n",
      "\t\"parameters\": {},\n",
      "\t\"outputs\": [\n",
      "\t\t{\n",
      "\t\t\t\"name\": \"predict\",\n",
      "\t\t\t\"shape\": [\n",
      "\t\t\t\t1,\n",
      "\t\t\t\t1\n",
      "\t\t\t],\n",
      "\t\t\t\"datatype\": \"INT64\",\n",
      "\t\t\t\"data\": [\n",
      "\t\t\t\t2\n",
      "\t\t\t]\n",
      "\t\t}\n",
      "\t]\n",
      "}\n"
     ]
    }
   ],
   "source": [
    "!seldon model load -f ./models/iris-v1.yaml\n",
    "!seldon model status iris -w ModelAvailable \n",
    "!seldon model infer iris -i 1 \\\n",
    "  '{\"inputs\": [{\"name\": \"predict\", \"shape\": [1, 4], \"datatype\": \"FP32\", \"data\": [[1, 2, 3, 4]]}]}' "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "1f15ac54",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{}\n",
      "Success: map[:iris_1::216 :iris_2::984]\n"
     ]
    }
   ],
   "source": [
    "!seldon model load -f ./models/iris-v2.yaml\n",
    "!seldon model infer iris --seconds 5 \\\n",
    "  '{\"inputs\": [{\"name\": \"predict\", \"shape\": [1, 4], \"datatype\": \"FP32\", \"data\": [[1, 2, 3, 4]]}]}' "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "ceramic-illness",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{}\r\n"
     ]
    }
   ],
   "source": [
    "!seldon model unload iris"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "3720658f",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.13"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
